class Ecommerce:

  @staticmethod
  def discount(price, disc):
    if 0 < disc < 1:
      return price * disc
    else:
      print("discount格式错误")

if __name__ == '__main__':
  goods = [
    {"name": "手套", "price": 12, "discount": 0.8},
    {"name": "水杯", "price": 35, "discount": 0.6},
    {"name": "纸巾", "price": 20, "discount": 0.9}
  ]
  # 遍历列表，取列表内字典的关键字
  for i in goods:
    print(f'{i["name"]}折扣后的价格是：{Ecommerce.discount(i["price"], 0.8)}')

